//
//  CmtActDetailCollectionViewCell.m
//  Products_B
//
//  Created by lanou on 16/6/3.
//  Copyright © 2016年 朋学友. All rights reserved.
//

#import "CmtActDetailCollectionViewCell.h"

@implementation CmtActDetailCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame{

    self = [super initWithFrame:frame];
    if (self) {
       
        self.image = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, (kWidth - 5) / 2,(kWidth - 5) / 2)];
        self.image.backgroundColor = [UIColor purpleColor];
        [self.contentView addSubview:_image];
        
        self.heag_img = [[UIImageView alloc]initWithFrame:CGRectMake(10, (kWidth - 5) / 2 + 15, 50, 50)];
        self.heag_img.backgroundColor = [UIColor grayColor];
        self.heag_img.layer.cornerRadius = 25;
        self.heag_img.layer.masksToBounds = YES;
        [self.contentView addSubview:_heag_img];
        
        self.nick = [[UILabel alloc]initWithFrame:CGRectMake(70, (kWidth - 5) / 2 + 20, 100, 25)];
        self.nick.font = [UIFont systemFontOfSize:14];
        self.nick.backgroundColor = [UIColor cyanColor];
        [self.contentView addSubview:_nick];
        
        self.create_time = [[UILabel alloc]initWithFrame:CGRectMake(70,(kWidth - 5) / 2 + 50, 100, 20)];
        self.create_time.font = [UIFont systemFontOfSize:12];
//        self.create_time.textColor =[UIColor grayColor];
        self.create_time.text = @"000";
        [self.contentView addSubview:_create_time];
        
        self.agree_count = [[UILabel alloc]initWithFrame:CGRectMake(frame.size.width - 50, (kWidth - 5) / 2 + 50, 30, 20)];
        self.agree_count.text = @"0";
        self.agree_count.textAlignment = NSTextAlignmentCenter;
        self.agree_count.font = [UIFont systemFontOfSize:12];
//        self.agree_count.textColor = [UIColor grayColor];
        [self.contentView addSubview:_agree_count];
        
        UIButton *button = [UIButton buttonWithType:(UIButtonTypeSystem)];
        button.frame =CGRectMake(frame.size.width - 30,(kWidth - 5) / 2 + 50, 30, 20);
        [button setImage:[UIImage imageNamed:@"cmtPraise.png"] forState:(UIControlStateNormal)];
        [button addTarget:self action:@selector(buttonAction:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.contentView addSubview:button];
    }
    return self;
}


-(void)buttonAction:(UIButton *)button{


}


-(void)setModel:(CmtActModel *)model{

    [self.image sd_setImageWithURL:[NSURL URLWithString:model.image]];
    [self.heag_img sd_setImageWithURL:[NSURL URLWithString:model.head_img]];
    self.nick.text = [NSString stringWithFormat:@"%@",model.nick];
    self.create_time.text = [NSString stringWithFormat:@"%@",model.create_time];
    self.agree_count.text = [NSString stringWithFormat:@"%@",model.agree_count];
}

@end
